<?php

namespace App\Domain\Account\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UpdateAccountPost extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'id' => 'required',
            'account' => 'required|string',
            'name' => 'required|string',
            'validity_time' => 'required',
            'state' => 'required',
            'phone' => 'required|mobile',
            'nickname' => '',
            'roleName' => 'required',
            'role_id' => 'required'
        ];
    }

    public function messages()
    {
        return [
            'id' => 'id不存在',
            'account.required' => '账号必填',
            'name.required' => '姓名必填',
            'validity_time.required' => '有效时间必填',
            'state.required' => '状态必填',
            'phone.required' => '手机号必填',
            'phone.mobile' => '请填写正确手机号',
            'roleName.required' => '角色必选',
            'role_id.required' => '角色必选',
        ];
    }
}
